﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.Data.DbUtils.DataMapping;
using PMS.Data.Entities.NaviMenus;

namespace PMS.Data.EntityMap.NaviMenus
{
    /// <summary>
    /// Represents a NaviMenu mapping configuration
    /// </summary>
    public partial class NaviMenuMap : PMSEntityTypeConfiguration<NaviMenu>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<NaviMenu> builder)
        {
            builder.ToTable("bus_navimenu");
            builder.HasKey(menu => menu.Id);

            builder.Property(menu => menu.LanguageCode).HasMaxLength(32).IsRequired();
            builder.Property(menu => menu.ParentId).IsRequired();
            builder.Property(menu => menu.MenuGroupId).IsRequired();
            builder.Property(menu => menu.PriceRange).HasMaxLength(500);
            builder.Property(menu => menu.MenuDepth).IsRequired();
            builder.Property(menu => menu.DisplayName).HasMaxLength(128).IsRequired();
            builder.Property(menu => menu.SubTitle).HasMaxLength(200);
            builder.Property(menu => menu.Description).HasMaxLength(200);
            builder.Property(menu => menu.MetaTitle).HasMaxLength(400);
            builder.Property(menu => menu.MetaKeywords).HasMaxLength(400);
            builder.Property(menu => menu.MetaDescription).HasMaxLength(65536);
            builder.Property(menu => menu.ShowOnHomepage).IsRequired();
            builder.Property(menu => menu.LayoutTemplateType).IsRequired();
            builder.Property(menu => menu.PageSize).IsRequired();
            builder.Property(menu => menu.PageSizeOptions).HasMaxLength(128).IsRequired();
            builder.Property(menu => menu.UrlRoute).HasMaxLength(200).IsRequired();
            builder.Property(menu => menu.BeautifyUrlRoute).IsRequired();
            builder.Property(menu => menu.UrlTarget).IsRequired();
            builder.Property(menu => menu.IconImageId).IsRequired();
            builder.Property(menu => menu.IconImageUrl).HasMaxLength(200).IsRequired();
            builder.Property(menu => menu.CoverImageId).IsRequired();
            builder.Property(menu => menu.CoverImageUrl).HasMaxLength(200).IsRequired();
            builder.Property(menu => menu.LimitedToStores).IsRequired();
            builder.Property(menu => menu.DisplayOrder).IsRequired();
            builder.Property(menu => menu.IsActive).IsRequired();
            builder.Property(menu => menu.CreatedOnTimeUtc).IsRequired();
            builder.Property(menu => menu.UpdatedOnTimeUtc).IsRequired();

            base.Configure(builder);
        }

        #endregion
    }
}
